﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace OneMG.Phoenix.Cache
{
    /// <summary>
    /// 缓存提供程序
    /// </summary>
    public interface ICacheProvider
    {
        #region Functions

        /// <summary>
        /// 判断缓存中是否存在指定名称的缓存项
        /// </summary>
        /// <param name="key">缓存项的名称</param>
        /// <returns>true,缓存中存在指定名称的缓存项;false,缓存中不存在指定的缓存项</returns>
        bool Contains(string key);

        /// <summary>
        /// 获取指定名称的缓存项内容
        /// </summary>
        /// <param name="key">缓存项的名称</param>
        /// <returns>缓存内容</returns>
        object Get(string key);

        /// <summary>
        /// 根据指定的名称集合获取缓存项集合
        /// </summary>
        /// <param name="keys">名称集合</param>
        /// <returns>缓存项集合</returns>
        IDictionary Gets(string[] keys);

        /// <summary>
        /// 添加缓存项
        /// </summary>
        /// <param name="key">缓存项的名称</param>
        /// <param name="value">缓存项的内容</param>
        void Add(string key, object value);
        //void Add(string key, object value, int hashCode);
        void Add(string key, object value, DateTime expr);
        //void Add(string key, object value, DateTime expr, int hashCode);

        /// <summary>
        /// 移除缓存项
        /// </summary>
        /// <param name="key">缓存项的名称</param>
        void Remove(string key);

        /// <summary>
        /// 清空缓存
        /// </summary>
        void Clear();

        #endregion
    }
}
